<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      const categoryList = [
        { id: 1, name: "油条" },
        { id: 2, name: "面包" },
        { id: 3, name: "豆浆" },
      ];
      const categoryList2 = categoryList.map((item) => {
        return { ...item, postList: [] };
      });
      console.log(categoryList);
      categoryList2[2].postList.push("肠粉");
      console.log(categoryList2);
    </script>
  </body>
</html>
